
package stcu.robjects;

import com.nvlled.route.*;

public class GroupJoin extends GroupObject {

    public static final String OK_MSG = "ok";

    private String username;

    public GroupJoin(String username, String gid) {
        super(gid);
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public static class Status extends RoutedObject {
        private String code;
        private String groupId;

        public Status(String code, String gid) {
            this.code = code;
            this.groupId = gid;
        }

        public Status(long id, String code, String gid) {
            super(id);
            this.code = code;
            this.groupId = gid;
        }

        public String getGroupId() {
            return groupId;
        }

        public boolean failed() {
            return !isOK();
        }

        public String getCode() {
            return code;
        }

        public boolean isOK() {
            return code.equals(OK_MSG);
        }
    }
}
